from math import sqrt

max_p = 1000
max_a = int(max_p / (1 + 1 + sqrt(2))) + 2
max_b = max_p / 2
print max_a, max_b

solutions = {}
for a in range(1, max_a):
    for b in range(a, max_b):
        a2 = a * a
        b2 = b * b
        c = int(sqrt(a2 + b2))
        if a2 + b2 != c * c:
            continue
        p = a + b + c
        if p > 1000:
            break
        s = solutions.get(p)
        if s is None:
            s = []
            solutions[p] = s
        s.append((a, b, c))

def slist():
    for p in solutions:
        s = solutions[p]
        yield len(s), p, s
            
for a, b, c in sorted(slist(), reverse = True):
    print a, b, c